<template>
    <van-popup v-model:show="show" position="bottom" round>
        <van-date-picker v-model="currentDate" title="选择年月" :min-date="minDate" :max-date="maxDate"
            @cancel="() => show = false" :columns-type="columnsType" @confirm="selectDate" />
    </van-popup>
</template>

<script setup>
import { ref } from 'vue';

const columnsType = ['year', 'month'];
const show = ref(false)
const minDate = new Date(2020, 0)
const maxDate = new Date()
const currentDate = ref([new Date()])
//const choseDate = ref('')
const emits = defineEmits(['selectDate'])

const selectDate = () => {
    show.value = false
    emits('selectDate', currentDate.value)
}


defineExpose({
    show,
})


</script>

<style lang="less" scoped></style>